<?php


namespace App\Transformers\System;


use App\Models\SystemLog;
use League\Fractal\TransformerAbstract;

class SystemLogTransformer extends TransformerAbstract
{
    public function transform(SystemLog $data)
    {
        return [
            'id' => $data->id,
            'admin_id' => $data->admin_id ?? '',
            'admin_name' => $data->admin_name ?? '',
            'merchant_id' => $data->merchant_id ?? '',
            'path' => $data->path ?? '',
            'action' => $data->action ?? '',
            'method' => $data->method ?? '',
            'ip' => $data->ip ?? '',
            'type' => $data->type ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
